function [v1, ve, p_exit] = valfunc_E(v2, z,y,param,glob,options)
% inputs 

    s = [z z];
    F            = menufun('F',s,y,param,glob,options);
              
    L            = menufun('L',s,y,param,glob,options);   
        
    sa           = [L, s(:,2)];
    
    cv           = param.beta*(1 - param.gamma)*v2(sa); 

    
    p_exit       = 1 - logncdf(cv, param.mu_f, param.sigma_f);
    idx          = p_exit < 1;
    
    exp_f_cost   = zeros(size(p_exit));
    exp_f_cost(idx)   = cond_logn_exp(cv(idx), param.mu_f, param.sigma_f);
    
    ve.v1           = F + (1-p_exit).*(cv - exp_f_cost);

    ve.l         = L;
    
    v1 = ve.v1;
    
end